package com.yl.web.controller.api;

import com.yl.common.annotation.Anonymous;
import com.yl.common.core.domain.AjaxResult;
import com.yl.common.core.page.TableDataInfo;
import com.yl.common.utils.PageUtils;
import com.yl.domain.ConferenceApplyDO;
import com.yl.domain.ConferenceDO;
import com.yl.domain.StudentReplyDO;
import com.yl.service.ConferenceApplyService;
import com.yl.service.ConferenceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 会议管理
 *
 * @author : y
 * @date :  2024/6/25 9:53
 **/
@RequestMapping("/conference/")
@RestController
@Anonymous
public class ConferenceController {
    private static final Logger log = LoggerFactory.getLogger(ConferenceController.class);
    @Resource
    ConferenceService conferenceService;
    @Resource
    ConferenceApplyService conferenceApplyService;

    @RequestMapping("save")
    @ResponseBody
    public AjaxResult save(@RequestBody ConferenceDO conferenceDO) {
        log.info("新增会议======参数={}", conferenceDO);
        AjaxResult result = conferenceService.save(conferenceDO);
        return result;
    }

    @RequestMapping("findPage")
    @ResponseBody
    public TableDataInfo findPage(@RequestBody ConferenceDO conferenceDO) {
        log.info("查看会议列表======参数={}", conferenceDO);
        PageUtils.startPage();
        return conferenceService.findPage(conferenceDO);
    }

    @RequestMapping("cancel")
    @ResponseBody
    public AjaxResult cancel(@RequestBody ConferenceDO conferenceDO) {
        log.info("取消会议======参数={}", conferenceDO);
        AjaxResult result = conferenceService.cancel(conferenceDO);
        return result;
    }


    @RequestMapping("findDetail")
    @ResponseBody
    public AjaxResult findDetail(@RequestBody ConferenceDO conferenceDO) {
        log.info("查看会议详情======参数={}", conferenceDO);
        AjaxResult result = conferenceService.getConferenceDetail(conferenceDO);
        return result;
    }

    /**
     * 统一开始面试  目前没地方在用 暂时废弃
     * @author : y
     * @date :  2024/6/27 14:52
     **/
    @RequestMapping("createBatchSession")
    @ResponseBody
    public AjaxResult createBatchSession(@RequestBody ConferenceDO conferenceDO) {
        log.info("批量创建面试场次======参数={}", conferenceDO);
        AjaxResult result = conferenceService.getConferenceDetail(conferenceDO);
        return result;
    }


    /**
     * 学生完成会议
     * 1. 学生结束面试，修改会议状态 （小组内只有一个人修改就可以了）
     * 2. 对接职行 创建该学生的面试训练 获取到session_id
     * @author : y
     * @date :  2024/7/14 11:42
     **/
    @RequestMapping("student/finish")
    @ResponseBody
    public AjaxResult finish(@RequestBody ConferenceApplyDO conferenceApplyDO) {
        log.info("学生结束面试=======入参={}", conferenceApplyDO);
        return conferenceApplyService.finish(conferenceApplyDO);
    }


}
